package cn.south.campus.business.controller;

import cn.south.campus.business.service.ConfigService;
import cn.south.campus.common.model.bo.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 *
 * </p>
 *
 * @author chow
 * @since 2024/12/13 14:08
 */
@RestController
@RequestMapping("campus/config")
public class ConfigController {

    @Resource
    private ConfigService configService;

    @GetMapping("refresh")
    public Result<Boolean> refresh(String key) {
        return Result.success(configService.refreshConfig(key));
    }

    @GetMapping("get/{key}")
    public Result<Object> getConfig(@PathVariable String key) {
        return Result.success(configService.getConfig(key));
    }

}
